

<%@page import="com.dilean.impl.model.attrval.AttrValueDate"%>
<%@page import="com.dilean.spring.AplicationContextHolder"%>
<%@page import="com.dilean.api.dao.PersonDAO"%>
<%@page import="com.dilean.impl.model.PersonImpl"%>
<%@page import="com.dilean.api.model.Person"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page session="true"%>
<%-- 
Document   : newjsp
Created on : 31.07.2014, 21:05:28
Author     : Р”РјРёС‚СЂРёР№
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Sign Up &middot; Dilean</title>

        <!-- Bootstrap Core CSS -->
        <link href="resources/mytheme/css/bootstrap.min.css" rel="stylesheet">

        <!-- Custom CSS -->
        <link href="resources/mytheme/css/simple-sidebar.css" rel="stylesheet">

        <script src="resources/mytheme/js/friendsDropdown.js"></script>

        <link href="resources/mytheme/css/font-awesome.css" rel="stylesheet">

        <link href="resources/mytheme/css/font-awesome.min.css" rel="stylesheet">


        <style>
            body {
                margin-top: 20px;
            }


        </style>

        <%
            
            String firstName=request.getParameter("firstname");
            String lastName =request.getParameter("lastname");
            String fullName=firstName+lastName;
            String email=request.getParameter("email");
            
            String month=request.getParameter("month");
            String day= request.getParameter("day");
            String year= request.getParameter("year");
            
            String dat=day+"/"+month+"/"+year;
            String password=request.getParameter("password");
            
            Date date = new SimpleDateFormat("d/m/yyyy").parse(dat);
            
            String gender="";
            if(request.getParameter("gender").compareToIgnoreCase("f")==1){
                gender="Male";
            }
            else{
                gender="Female";
            }
            
             Person newPerson = new PersonImpl();
             newPerson.setName(fullName);
             
            // TODO ADD SAVE PARAMETERS and person
             /*
             final Integer newPersonId =  AplicationContextHolder.getInstance().getContext().getBean(PersonDAO.class).save(newPerson).getId();
             //todo CHANGE ID=1 to another one
             AttrValueDate registration = AplicationContextHolder.getInstance().getContext().getBean(PersonDAO.class).findById(1).getAttributeValue(11, AttrValueDate.class);
            registration.setValue(date);
            newPerson.setParameter(registration.getAttribute().getId(), registration);
        newPerson.setParameterForUpdate(registration.getAttribute().getId(), registration);
        AplicationContextHolder.getInstance().getContext().getBean(PersonDAO.class).save(newPerson);

// newPerson = AplicationContextHolder.getInstance().getContext().getBean(PersonDAO.class).save(entity)

            */
            
            
        %>





    </head>
    <body>

        <div class="container">
            <div class="row">
                <div class="well col-xs-10 col-sm-10 col-md-6 col-xs-offset-1 col-sm-offset-1 col-md-offset-3">
                    <div class="row">
                        <div class="col-xs-6 col-sm-6 col-md-6">

                        </div>
                        <div class="col-xs-6 col-sm-6 col-md-6 text-right">

                        </div>
                    </div>
                    <div class="row">
                        <div class="text-center">
                            <h1>Register success</h1>
                        </div>
                        </span>
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>Parameter</th>
                                    <th class="text-center">Value</th>                                   
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td class="col-md-9"><em>First Name</em></h4></td>
                                    <td class="col-md-1" style="text-align: center"> <%= firstName %> </td>

                                </tr>
                                <tr>
                                    <td class="col-md-9"><em>Last Name</em></h4></td>
                                    <td class="col-md-1" style="text-align: center"> <%= lastName %> </td>

                                </tr>
                                <tr>
                                    <td class="col-md-9"><em>E-mail Adress</em></h4></td>
                                    <td class="col-md-1" style="text-align: center"> <%= email %> </td>

                                </tr>

                                <tr>
                                    <td class="col-md-9"><em>Birth Data</em></h4></td>
                                    <td class="col-md-1" style="text-align: center"> <%= date %> </td>

                                </tr>

                                <tr>
                                    <td class="col-md-9"><em>Gender</em></h4></td>
                                    <td class="col-md-1" style="text-align: center"> <%= gender %> </td>

                                </tr>

                            </tbody>
                        </table>

                        <form action="index.jsp"  name="myForm" >
                            <button type="submitt" class="btn btn-success btn-lg btn-block">
                                ContinueВ В В <span class="glyphicon glyphicon-chevron-right"></span>
                            </button></td>
                        </form>

                    </div>
                </div>
            </div>
    </body>
</html>